<template>
  <el-form :model="form" label-width="120px">
    <el-form-item label="轮播名称">
      <el-input v-model="form.name" />
    </el-form-item>
    <el-form-item label="广告连接">
      <el-input v-model="form.link" />
    </el-form-item>
    <el-form-item label="轮播图片">
      <ImgUpload v-model="form.url" />
    </el-form-item>

    <el-form-item label="是否显示">
      <el-switch v-model="form.show" />
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="onSubmit">录入</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import request from "../../utils/request";
import ImgUpload from "../../components/img-upload.vue";
export default {
  components: {
    ImgUpload,
  },
  data() {
    return {
      form: {
        name: "100万的轮播",
        link: "http://1000phone.com",
        url: "http://www.qfedu.com/2022/1130/1669787087805.jpg",
        show: true,
      },
    };
  },
  methods: {
    onSubmit() {
      console.log(this.form);
      request.post("/classes/VueBanner", this.form);
    },
  },
};
</script>
